home *** CD-ROM | disk | FTP | other *** search
- dseg segment word
- assume ds:dseg
-
- extrn DosUpcase : dword
- extrn LocaseTranslationtable : byte
-
- dseg ends
-
- cseg segment word
- assume cs:cseg
-
- locals @@
-
- dummy proc far
- ; DosUpcase points to here under DOS < 3.0
- public dummy
-
- retf
- dummy endp
-
- ; function upcase ----------------------------
- upcase proc far
- public upcase
- mov bx,sp
- mov al,ss:[bx+4] ; Get character into al
-
- cmp al,97 ; 'a'
- jb @@1 ; If below, it can't be converted
-
- cmp al,122 ; 'z'
- jbe @@2 ; If below, it's a standard lower case char
-
- call [DosUpcase] ; Let DOS do the conversion
- ; DOS ignores characters below #128
-
- jmp short @@1
-
- @@2: sub al,32 ; Convert to upper case
-
- @@1: retf 2 ; Remove parameter and return
-
- upcase endp
-
- ; function locase ----------------------------
-
- locase proc far
- public locase
-
- mov bx,sp
- mov al,ss:[bx+4] ; Get character into al
-
- cmp al,65 ; 'A'
- jb @@1 ; If below, it can't be converted
-
- cmp al,90 ; 'Z'
- jbe @@2 ; If below, it's a standard upper case char
-
- cmp al,127 ; Is it in the extended char range ?
- jbe @@1 ; No, cannot convert
-
- sub al,128 ; Yes, relocate for table [128..255]
-
- mov bx,offset LocaseTranslationtable
- xlat ; Actual convertion
-
- jmp short @@1
-
- @@2: add al,32 ; Convert to lower case
-
- @@1: retf 2 ; Remove parameter and return
-
- locase endp
-
- cseg ends
-
- end